home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Source Code / Add-Ons / After Dark / ScreenFlip 1.5 / Source / ScreenFlip.h < prev    next >
Text File  |  1995-12-05  |  2KB  |  64 lines

  1. /* ScreenFlip.h  --  type definitions & other header file stuff.
  2. */
  3.  
  4.      // Include file for the GWorld offscreen drawing stuff.
  5. #include <QDoffscreen.h>
  6.  
  7.     // Flipping the screen is implemented as a kind of rudimentary state machine.
  8.     // At any time the module is in one of four flip states. kHorizontal and
  9.     // kVertical mean we're in the processing of doing a horizontal resp. vertical
  10.     // screen flip (duh). kSwitch means we are going to determine which direction
  11.     // the next flip will be in. kNone means we are in a state of rest
  12.     // between flips. kSwitch always comes at the end of a kNone period.
  13. typedef enum 
  14.     kHorizontal, 
  15.     kVertical, 
  16.     kSwitch, 
  17.     kNone 
  18. TFlipStates;
  19.  
  20.  
  21.     // This is a secondary state, which controls the direction the ripples of
  22.     // the current animation are moving in (for the kVertical and kHorizontal flip states).
  23. typedef enum 
  24.     kInwards, 
  25.     kOutwards
  26. }
  27. TDirectionStates;
  28.  
  29.  
  30. // In the following data structure most two-element arrays store information
  31. // pertaining horizontal flips in the first element, and the same information
  32. // for the vertical case in the second element. This makes it possible to
  33. // write things like 'bufworld[kVertical]' or 'maxStep[kHorizontal]', which is
  34. // not only very clear, but also allows us to eliminate a lot of code duplication.
  35.  
  36. typedef struct
  37. {                
  38.     GWorldPtr bufWorld[2];        // Small buffers for storing a row resp. column of pixels.
  39.     GWorldPtr offWorld;        // Large buffer for storing a copy of the entire screen.
  40.     
  41.     PixMapHandle screenMap;    // Bitmap for an entire screen.
  42.     PixMapHandle realMap;        // Bitmap for the physical screen.
  43.     PixMapHandle bufMap[2];    // Bitmaps associated with the bufWorld array.
  44.     
  45.     Rect strip[2];                // Which two columns/rows to swap this step.
  46.     Rect bufRect[2];            // Bounding rectangles associated with bufWorld.
  47.     Rect r;                    // Bounding rectangle of the screen.
  48.     
  49.     TFlipStates movement;        // Current flip state.
  50.     TDirectionStates direction;    // Current ripple movement.
  51.     int t;                    // The current step (each step, two columns/rows get switched).
  52.  
  53.     long startTick, delay;        // Variables for keeping track of delays between flips.
  54.     int maxStep[2];            // After this many steps before flip is finished.
  55.  
  56.     Boolean demoMode;            // Are we currently in After Dark demo mode?
  57.     Boolean instantFlip;            // Corresponds to check box in module interface.
  58. }
  59. TFlipData, *TFlipDataPtr;
  60.  
  61.